<?php
    function ketnoi()
    {
//	 $server="localhost";
//	 $database="mydb";
//	 $username="root";
//	 $password=""; 

	  // $server="localhost";
	  // $database="gilf";
	  // $username="root";
	  // $password=""; 
	  $server="localhost";
	  $database="ztruyen_gilf";
	  $username="ztruyen";
	  $password="01686464a"; 
	 
	 
	//ket noi den may chu
	
	//mysqli_connect($server,$username,$password) or die('khong the ket noi server');
         try {
                 $link = mysqli_connect("localhost", "$username", "$password", "$database") or die('khong the ket noi db');
				 $link->query("SET NAMES 'utf8'");
                 mysqli_select_db ($link,$database) or die('khong the ket noi csdl troi');
                // echo "ket noi csdl thanh cong";
                return $link; 
              }
        catch(PDOException $e)
            {
                 echo $e->getMessage();
                 return null;
            }

    }

?>